home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
64'er 1991 June
/
64er_Magazin_91-06_1991_Markt__Technik_de.d64
/
regula falsi
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
742b
|
36 lines
10 print"[147]":rem regula falsi
20 print" berechnung von nullstellen"
25 print" fuer ganze rat. funktionen"
30 print" nach der regula falsi"
40 print" **************************"
50 print:input" grad der funktion:";g:print
70 dimk(g)
80 fori=gto0step-1
85 print" koeffizient fuer x^"i;:inputk(i)
90 nexti
94 :
95 goto150
100 rem up horner-schema
110 y=k(g)
120 fori=gto1step-1
130 y=y*x+k(i-1)
140 nexti
145 return
150 :
160 print:input" naeherungswert x0 ";x0
170 input" naeherungswert x1 ";x1
195 :
200 x=x0:gosub100:y0=y
220 x=x1:gosub100:y1=y
225 :
230 ifsgn(y0)=sgn(y1)thenprint" sekante schneidet x-achse nicht":goto160
235 :
240 x2=x0-y0*((x1-x0)/(y1-y0))
250 x=x2:gosub100:y2=y
270 ifabs(y2)<1e-6then290
275 ifsgn(y2)=sgn(y1)thenx1=x2:goto200
280 ifsgn(y2)=sgn(y0)thenx0=x2:goto200
290 print:print" nullstelle bei x="x2
300 print:print" y-wert an der stelle="y2
310 goto160